package com.linchong.concurrency.chapter8;

/**
 * @Author:linchong
 * @CreateTime:2020-01-07 09:35
 * @Description:死锁测试
 */
public class DeadLock {
	private final OtherService otherService;
	private final Object lock = new Object();

	public DeadLock(OtherService otherService) {
		this.otherService = otherService;
	}

	public void m1() {
		synchronized (lock) {
			System.out.println("m1====>");
			otherService.s1();
		}
	}

	public void m2() {
		synchronized (lock) {
			System.out.println("m2====>");
		}
	}
}
